import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
import { createStyleImportPlugin, AntdResolve } from "vite-plugin-style-import";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react(),
    createStyleImportPlugin({
      resolves: [AntdResolve()],
    }),
  ],
  resolve: {
    // 配置别名@为src引入
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },

  server: {
    host: "0.0.0.0",
    proxy: {
      "/api": {
        target: "http://172.247.5.210:8080",
        // target: "http://localhost:8080",
        ws: false,
        changeOrigin: true,
        // rewrite: path => path.replace(/^\/api/, '')
      },
    },
  },
});
